package com.open.demo.location

import android.app.Activity
import android.os.Bundle
import android.os.Looper
import android.util.Log
import com.tencent.map.geolocation.TencentLocation
import com.tencent.map.geolocation.TencentLocationListener
import com.tencent.map.geolocation.TencentLocationManager

/**
 * 腾讯定位服务 https://lbs.qq.com/mobile/androidLocationSDK/androidGeoGuide/androidGeoSingle
 *
 * @Author: hailong.qiu hailong.qiu@xgimi.com
 * @Maintainer: hailong.qiu hailong.qiu@xgimi.com
 * @Date: 2021/9/7
 * @Copyright: 2021 www.xgimi.com Inc. All rights reserved.
 */
class TencentLocationActivity : Activity(), TencentLocationListener {

    val locationManager by lazy { TencentLocationManager.getInstance(this) }

    companion object {
        const val TAG = "腾讯定位Demo"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.d(TAG, "onCreate");
        locationManager.requestSingleFreshLocation(null, this, Looper.getMainLooper())
    }

    override fun onLocationChanged(location: TencentLocation?, p1: Int, p2: String?) {
        Log.d(TAG, "onLocationChanged location:${location} ${p1} ${p2}")
    }

    override fun onStatusUpdate(p0: String?, p1: Int, p2: String?) {
        Log.d(TAG, "onStatusUpdate ${p0} ${p1} ${p2}")
    }

}